package com.zzc.alfred.entity.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.zzc.alfred.entity.model.ProductIndexModel;

public interface ProductIndexModelMapper {

	/**
	 * 获取新增商品
	 * 
	 * @return
	 */
	@Select("select * from t_product_info where create_time > #{beginTime} and id is not null and name is not null ")
	@Results({ @Result(id = true, column = "id", property = "id"), @Result(column = "sku_id", property = "skuId"),
			@Result(column = "brand", property = "brandName"), @Result(column = "name", property = "productName"),
			@Result(column = "params", property = "params"), @Result(column = "image_url", property = "imageUrl"),
			@Result(column = "price", property = "price"), @Result(column = "product_url", property = "productUrl"),
			@Result(column = "web_source", property = "webSource") })
	public List<ProductIndexModel> getAddedProduct(Date beginTime);

	@Select("select * from t_product_info where id = #{id}")
	@Results({ @Result(id = true, column = "id", property = "id"), @Result(column = "sku_id", property = "skuId"),
			@Result(column = "brand", property = "brandName"), @Result(column = "name", property = "productName"),
			@Result(column = "params", property = "params"), @Result(column = "imageUrl", property = "image_url") })
	public ProductIndexModel getProductByKey(String id);

	@Select("select * from t_product_info where category_name='鼠标'  limit 0,1000")
	@Results({ @Result(id = true, column = "id", property = "id"), @Result(column = "sku_id", property = "skuId"),
			@Result(column = "brand", property = "brandName"), @Result(column = "name", property = "productName"),
			@Result(column = "params", property = "params"), @Result(column = "image_url", property = "imageUrl"),
			@Result(column = "price", property = "price"), @Result(column = "product_url", property = "productUrl"),
			@Result(column = "web_source", property = "webSource") })
	public List<ProductIndexModel> getAddedProductForMahout();

}
